<?php session_start(); ?>
<?php
define("EW_PAGE_ID", "list", TRUE); // Page ID
define("EW_TABLE_NAME", 'tb_dailyrx', TRUE);
?>
<?php 
session_start(); // Initialize session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg50.php" ?>
<?php include "ewmysql50.php" ?>
<?php include "phpfn50.php" ?>
<?php include "tb_dailyrxinfo.php" ?>
<?php include "userfn50.php" ?>
<?php include "tb_usersinfo.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php
$Security = new cAdvancedSecurity();
?>
<?php
if (!$Security->IsLoggedIn()) $Security->AutoLogin();
if (!$Security->IsLoggedIn()) {
	$Security->SaveLastUrl();
	header("Location: login.php");
	exit();
}
?>

<?php require_once('../Connections/MYCONN.php'); ?>
<?php

global $parentid;
global $CheckAmt;
global $CashAmt;
global $CreditAmt;
global $DepositAmt;
global $LunchAmt;
global $MetroAmt;
global $OverringAmt;
global $PayoutAmt;
global $IPPSaleAmt;
global $XReadingAmt;

if($parentid == ""){
$parentid=0;
}

function IsNull($theValue)
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
  $theValue = ($theValue != "") ? $theValue : "";
  return trim($theValue);
}

if( isset($_GET["ID"]) && $_GET["ID"] != ""  )
{
	$parentid = $_GET["ID"];
}else 
{
	$parentid=0;
}

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "0";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}


if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frmLog")) {
  $insertSQL = sprintf("INSERT INTO tb_activity (ParentID, LookupID, `Value`, Description) VALUES (%s, %s, %s,%s)",
                       GetSQLValueString($_POST['ParentID'], "int"),
                       GetSQLValueString($_POST['ActivityID'], "int"),
                       GetSQLValueString($_POST['ActivityValue'], "double"),
                       GetSQLValueString($_POST['ActivityNote'], "text"));
					  // echo $insertSQL;

  	mysql_select_db($database_MYCONN, $MYCONN);
  	$Result1 = mysql_query($insertSQL, $MYCONN) or die(mysql_error());
  
    $insertGoTo = "ActivityLog.php?ID=".$parentid;
	header(sprintf("Location: %s", $insertGoTo));
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formIPP")) {

  $insertSQL = sprintf("INSERT INTO tb_cashlog (UserID, LogDate, LocationID, TotalIPPSales, XReading, RegisterID) VALUES (%s, %s, %s,%s,%s, %s)",
						GetSQLValueString($_POST['frmUserID'], "int"),
						GetSQLValueString($_POST['frmlogdate'], "date"),
						GetSQLValueString($_POST['frmLocationID'], "int"),
						GetSQLValueString($_POST['frmippsales'], "double"),
						GetSQLValueString($_POST['frmxreading'], "double"),
						GetSQLValueString($_POST['frmreigisterID'], "int"));

 //echo $insertSQL;
 	mysql_select_db($database_MYCONN, $MYCONN);
  	$Result1 = mysql_query($insertSQL, $MYCONN) or die(mysql_error());

  	$insertGoTo = "ActivityLog.php?ID=".mysql_insert_id();
	header(sprintf("Location: %s", $insertGoTo));
}
 
mysql_select_db($database_MYCONN, $MYCONN);
if( isset($_GET["ID"]) && $_GET["ID"] != ""  )
{
$query_RecCashLog = "SELECT * FROM tb_cashlog WHERE ID = ".$_GET["ID"];
$parentid = $_GET["ID"];
}else 
{
$query_RecCashLog = "SELECT * FROM tb_cashlog WHERE ID = 0";
}
$RecCashLog = mysql_query($query_RecCashLog, $MYCONN) or die(mysql_error());
$row_RecCashLog = mysql_fetch_assoc($RecCashLog);
$totalRows_RecCashLog = mysql_num_rows($RecCashLog);

mysql_select_db($database_MYCONN, $MYCONN);
$query_RecRegister = "SELECT tb_register.ID, tb_register.RegisterID FROM tb_register ORDER BY tb_register.RegisterID";
$RecRegister = mysql_query($query_RecRegister, $MYCONN) or die(mysql_error());
$row_RecRegister = mysql_fetch_assoc($RecRegister);
$totalRows_RecRegister = mysql_num_rows($RecRegister);

mysql_select_db($database_MYCONN, $MYCONN);
$query_rLookups = "SELECT tb_lookups.ID, tb_lookups.Name, tb_lookups.Name FROM tb_lookups order by Name ";
$rLookups = mysql_query($query_rLookups, $MYCONN) or die(mysql_error());
$row_rLookups = mysql_fetch_assoc($rLookups);
$totalRows_rLookups = mysql_num_rows($rLookups);

mysql_select_db($database_MYCONN, $MYCONN);
$query_ActSummary = "select  l.Name, a.Value*l.NameValue*l.Direction Amount from tb_activity a, tb_lookups l where a.LookupID=l.ID AND a.ParentID=".$parentid;
$ActSummary = mysql_query($query_ActSummary, $MYCONN) or die(mysql_error());
$row_ActSummary = mysql_fetch_assoc($ActSummary);
$totalRows_ActSummary = mysql_num_rows($ActSummary);



mysql_select_db($database_MYCONN, $MYCONN);
$query_rActivity = "SELECT 	a.ID, a.ParentID, l.Name as ActivityDesc, a.`Value` Quantity, a.`Value` as ActivityValue, a.Description as ActivityNote
FROM 	tb_activity a, tb_lookups l
WHERE 	a.LookupID=l.ID AND a.ParentID=".$parentid." ORDER BY l.Name ";
$rActivity = mysql_query($query_rActivity, $MYCONN) or die(mysql_error());
$row_rActivity = mysql_fetch_assoc($rActivity);
$totalRows_rActivity = mysql_num_rows($rActivity);

mysql_select_db($database_MYCONN, $MYCONN);
$query_Recordset1 = "SELECT t.ID,CONCAT(Date(LogDate),'::',upper(u.UserName),'::',r.RegisterID) as Link  	
						FROM tb_cashlog t, tb_users u, tb_register r WHERE t.UserID = u.ID AND t.RegisterID = r.ID AND t.logdate >= (CAse when (select Date(ControlDate) from tb_controlview where status ='Y') is null then 
			Date('2000-01-01 00:00:00')
		else
			(select Date(ControlDate) from tb_controlview where status ='Y')
		end)" 	;

if(CurrentUserName()=="jacob" || CurrentUserName()=="admin" || CurrentUserName()=="master")
{
	$query_Recordset1 = $query_Recordset1." ORDER BY t.LogDate DESC ";
}
else
{
	$query_Recordset1 = $query_Recordset1." AND u.UserName = '".CurrentUserName()."' ORDER BY t.LogDate DESC ";
}
//echo $query_Recordset1;

$Recordset1 = mysql_query($query_Recordset1, $MYCONN) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

define("ewTblVar", "SummaryInfoReport", true);
define("ewTblShowMaster", "showmaster", true);
define("ewSessionTblMasterKey", "SummaryInfoReport_MasterKey", true);
define("ewSessionTblMasterWhere", "SummaryInfoReport_MasterWhere", true);
define("ewSessionTblDetailWhere", "SummaryInfoReport_DetailWhere", true);

// Report level SQL
// Report group level SQL

define("ewSqlGrpSelect", "SELECT DISTINCT `Lookup` FROM tb_lookups l, tb_activity a", true);
define("ewSqlGrpWhere", "(a.LookupID = l.ID)  AND a.ParentID=".$parentid, true);
define("ewSqlGrpGroupBy", "", true);
define("ewSqlGrpHaving", "", true);
define("ewSqlGrpOrderBy", "`Lookup`", true);

// Report detail level SQL
define("ewSqlDtlSelect", "SELECT l.Lookup, l.Name, a.Value * l.NameValue * l.Direction AS Amount FROM tb_lookups l, tb_activity a", true);
define("ewSqlDtlWhere", "(a.LookupID = l.ID)  AND a.ParentID=".$parentid, true);
define("ewSqlDtlGroupBy", "", true);
define("ewSqlDtlHaving", "", true);
define("ewSqlDtlOrderBy", "l.Name ASC", true);
define("ewSqlUserIDFilter", "", true);

$sExport = @$_GET["export"]; // Load export request
if ($sExport == "excel") {
	header('Content-Type: application/vnd.ms-excel');
	header('Content-Disposition: attachment; filename=' . ewTblVar .'.xls');
}
if ($sExport == "csv") {
	header('Content-Type: application/csv');
	header('Content-Disposition: attachment; filename=' . ewTblVar .'.csv');
}


function getUserID($usr,$database_MYCONN, $MYCONN){
	mysql_select_db($database_MYCONN, $MYCONN);
	$query_RecUser = "SELECT tb_users.ID FROM tb_users WHERE tb_users.UserName = '".$usr."'";
	$RecUser = mysql_query($query_RecUser, $MYCONN) or die(mysql_error());
	$row_RecUser = mysql_fetch_assoc($RecUser);
	$totalRows_RecUser = mysql_num_rows($RecUser);

	do 
	{  
	$usrid = $row_RecUser['ID'] ;
	
	} while ($row_RecUser = mysql_fetch_assoc($RecUser));
	$rows = mysql_num_rows($RecUser);
	if($rows > 0) {
	mysql_data_seek($RecUser, 0);
	$row_RecUser = mysql_fetch_assoc($RecUser);
	}

return $usrid;

}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>
<?php //include("../title.php") ;?>
</title>
<link rel="stylesheet" type="text/css" media="all" href="../calendar/calendar-win2k-1.css" title="win2k-1" />
<script type="text/javascript" src="../calendar/calendar.js"></script>
<script type="text/javascript" src="../calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="../calendar/calendar-setup.js"></script>
<script language="javascript1.2">
<!--
var requester = null;

function createXMLReq()
{
	 if (requester != null && requester.readyState != 0 && requester.readyState != 4)
	 {
	   requester.abort();
	 }
	
	 try
	 {
	   requester = new XMLHttpRequest();
	 }
	 catch (error)
	 {
	   try
	   {
		 requester = new ActiveXObject("Microsoft.XMLHTTP");
	   }
	   catch (error)
	   {
		 requester = null;
	
		 return false;
	   }
	  }
}
function updateDB(TblName, ID, CName, Value)
{
 /* Check for running connections */

  	createXMLReq();
  
	requester.onreadystatechange = onreadystatechangeReceipt;
	actionURL = "action.php?TblName=" + TblName+"&CName="+CName+"&ID="+ID+"&Value="+Value+"&Action=100";
	//	alert(actionURL);
	requester.open("POST", actionURL);
	requester.send(null);
	
	return true;

}

function deleteAll(TblName, ID, Scope)
{

var userresponse =	confirm("Do you want delete all cash log entries?");

if(userresponse == true ){
	window.location.href = "delete.php?ParentID="+ID+"&TblName=" + TblName+"&ID="+ID+"&Action="+Scope;	
	return true;
}

}

function deleteDB(ParentID, TblName, ID)
{
	window.location.href = "delete.php?ParentID="+ParentID+"&TblName=" + TblName+"&ID="+ID+"&Action=-1";
	return true;
}


function onreadystatechangeReceipt()
{
 /* If XMLHR object has finished retrieving the data */
 if (requester.readyState == 4)
 {
   /* If the data was retrieved successfully */
   if (requester.status == 200)
   {
     //alert("success");
	 WriteDetails();
   }
   /* IE returns a status code of 0 on some occasions, so ignore this case */
   else if (requester.status != 0)
   {
     alert("There was an error while retrieving the URL: " + requester.statusText);
   }
 }

 return true;
}

function WriteDetails()
{
//alert(requester.responseText);
if(requester.responseText != "1" )
{
alert("Error occured while database request.\nPlease review again.\n"+requester.responseText);
}

return true;
}

function CheckValue(obj)
{
	if(obj.value == ""){
		obj.value = 0;
	}

}
function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}
function GetCookie (name) { 
var arg = name + "="; 
var alen = arg.length; 
var clen = document.cookie.length; 
var i = 0; 
while (i < clen) { 
var j = i + alen; 
if (document.cookie.substring(i, j) == arg) 
return getCookieVal (j); 
i = document.cookie.indexOf(" ", i) + 1; 
if (i == 0) break; 
} 
return null; 
}
function openWindow(url)
{
    var w = window.open (url, "win", "height=400,width=400,location=no,menubar=no,resizable,scrollbars=yes,status=no,toolbar=no");
}

//-->
</script>
<link rel="stylesheet" type="text/css" href="../mystyle.css">
<link href="../boca2.css" rel="stylesheet" type="text/css" />
<link href="../phpSite.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
.style11 {color: #FFFFFF}
-->
</style>
</head>
<!--1126892761-->
<body onLoad="validateDate();">
<script language="javascript1.2">
function EditLog(val){
window.location.href="ActivityLog.php?ID="+val;
}

function makeAllReadOnlyExceptSubmit()
{
var arrElements = document.all;
	for(var i=0; i<arrElements.length; i++){
	//arrElements[i].disabled=true;
	arrElements[i].readOnly=true;
	if(arrElements[i].type=="button" || arrElements[i].type=="submit"){
	arrElements[i].disabled=true;
	}
	}
}
function validateDate(){
//var curdt = new Date();
//var today=curdt.getFullYear()+"/"+curdt.getMonth()+"/"+curdt.getDate();
//var lgdate=document.formIPP.frmlogdate.value;
//var usrInput;
//	if(today==lgdate){
//	alert("same day, you can maked changes!!!");
//	}else{
//	alert(document.form1.adminPWD.value);
//		if(document.form1.adminPWD.value!="test"){
//					usrInput=prompt("Enter admin password!!!");
//					if(usrInput=="test"){
//						document.form1.adminPWD.value=usrInput;
//					}else{
//						makeAllReadOnlyExceptSubmit();
//						alert("pwd is wrong, try again");
//					}
//			}
//	}

}
</script>
<?php 
if(CurrentUserName()=="jacob" or CurrentUserName()=="genuser" or CurrentUserName()=="admin" or CurrentUserName()=="master")
{

	include ("../header.php") ;
}

?>

<table border="0" cellpadding="0" cellspacing="0" class="TAB-MAIN">
  <tr >
	<td colspan="3" align="left" valign="top">
			<strong>Edit Cash Log :</strong>
			<select  style="width:180;" name="EditLog" id="EditLog" onChange="EditLog(this.options[this.selectedIndex].value);">
			<option value="0">Select Log for Edit</option>
			<?php do { ?>
			<option value="<?php echo $row_Recordset1['ID']; ?>"><?php echo $row_Recordset1['Link']; ?></option>
			<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
			</select></td>
  </tr>
  <tr>
    <td colspan="3" bgcolor="#000000" height="3px"></td>
  </tr>
  <tr bordercolor="#999999" bgcolor="#9999CC">
		<td colspan="2" valign="top" nowrap="nowrap" class="COLUMN-HEADER"><?php 
		echo "Welcome : ".CurrentUserName(); 
		if(CurrentUserName()=="jacob" OR CurrentUserName()=="admin" || CurrentUserName()=="master")
		{
		echo	" | <a href='tb_lookupslist.php'>Go To List</a>";
		}
		else
		{
		echo "";
		};
		?>
		| <a href="../logout.php">Logout</a>
		<?PHP //if($row_RecCashLog['ID']!=0){ ?>
		| <a href='#' onClick="openWindow('dailyactivityreport.php?ID=<?php echo $row_RecCashLog['ID'] ?>');" >Print View </a>
		<?php //}?></td>
		<td align="right" valign="top"  nowrap="nowrap"><?php if($parentid > 0){?>
		<input type="button"  style="background:#FF0000; color:#FFFFFF; font-weight:bold; height:22px; width:160px" value="Add New Cashlog Entry" name="AddNewLog" onClick="window.location.href='ActivityLog.php?ID=0'">
		<?php }else{?>
		&nbsp;
		<?php }?>		</td>
  </tr>
  <tr>
    <td colspan="3" bgcolor="#000000" height="2px"></td>
  </tr>

  <tr>
    <td nowrap="nowrap" valign="top">
<table border="0" bordercolor="#0033CC" class="COLUMN-HEADER">
		<form id="formIPP" name="formIPP" method="POST" action="<?php echo $editFormAction; ?>">		  
		<tr>
				  <td width="79"><strong>LogDate:</strong></td>
				  <td width="192" valign="top" nowrap="nowrap" align="left">
				    <input type="text"  style="height:20; width:100px;" name="frmlogdate" value="<?php echo ew_FormatDateTime($row_RecCashLog['LogDate'],5); ?>" onChange="updateDB('tb_cashlog',<?php echo ($row_RecCashLog['ID']=="")?0:$row_RecCashLog['ID']; ?>, 'LogDate', this.value);" />
                <img src="../images/ew_calendar.gif" alt="Pick a Date" width="20" height="20" id="cfrmlogdate" style="cursor:pointer;cursor:hand;">
                <script type="text/javascript">
						Calendar.setup(
						{
						inputField : "frmlogdate", // ID of the input field
						ifFormat : "%Y/%m/%d", // the date format
						button : "cfrmlogdate" // ID of the button
						}
						);
                </script>			</td>
		  </tr>
				<tr>
				<td><strong>RegID:</strong></td>
				<td><select  name="frmreigisterID"  onChange="updateDB('tb_cashlog',<?php echo ($row_RecCashLog['ID']=="")?0:$row_RecCashLog['ID']; ?>, 'RegisterID', this.value);" >
                  <?php
					do {  
					?>
                  <option value="<?php echo $row_RecRegister['ID']?>"
					<?php if (!(strcmp($row_RecRegister['ID'], $row_RecCashLog['RegisterID'])))
					{
					echo "selected=\"selected\"";
					} ?>><?php echo $row_RecRegister['RegisterID'] ?></option>
                  <?php
					} while ($row_RecRegister = mysql_fetch_assoc($RecRegister));
					$rows = mysql_num_rows($RecRegister);
					if($rows > 0) {
					mysql_data_seek($RecRegister, 0);
					$row_RecRegister = mysql_fetch_assoc($RecRegister);
					}
					?>
                  </select>			</td>
			</tr>
			<tr>
			 <td><strong>Total IPP:</strong></td>
			 <td><input type="hidden" name="frmUserID" value="<?PHP echo getUserID();?>">
                <input type="hidden" name="frmLocationID" value="ZZ">                
							<input type="text" name="frmippsales" value="<?php echo ($row_RecCashLog['TotalIPPSales']=="")?0:$row_RecCashLog['TotalIPPSales']; ?>" onChange="updateDB('tb_cashlog',<?php echo ($row_RecCashLog['ID']=="")?0:$row_RecCashLog['ID']; ?>, 'TotalIPPSales', this.value);"/>			</td>
			</tr>
			<tr>
			 <td><strong>X Read:</strong></td>
			  <td><input type="text" name="frmxreading" value="<?php echo ($row_RecCashLog['XReading']=="")?0:$row_RecCashLog['XReading']; ?>" onChange="updateDB('tb_cashlog',<?php echo ($row_RecCashLog['ID']=="")?0:$row_RecCashLog['ID']; ?>, 'XReading', this.value);"/></td>				  				  				  
			</tr><tr>
			<td>
			<input type="button" value="Delete" name="Delete" onClick="deleteAll('tb_cashlog', <?php echo $parentid ?>,99);" >
			<!-- <img src="images/delete.jpg" alt="DeleteAll" width="71" height="20"  class="Btn" onClick="deleteAll('tb_cashlog', <?php echo $parentid ?>,99);" <?php // echo ($parentid > 0)?" disabled":" "; ?>> -->
			</td>
<td>
<input type="button" value="Save Entries" name="Save Entries" onClick="formIPP.submit();">
<!-- <img src="images/saveEntries.jpg" alt="Save Log Entries" class="Btn" onClick="formIPP.submit();" <?php //echo ($parentid > 0)?" disabled":" "; ?>> -->
</td>				  				  				  			</tr><tr>
				  <td>		
				  <?php 
				$IPPSaleAmt = $row_RecCashLog['TotalIPPSales'] ;
				$XReadingAmt = $row_RecCashLog['XReading'] ;
				?>
				<input type="hidden" name="MM_insert" value="formIPP">			</td><td>&nbsp;</td>				  				  				  				  				  
			  </tr>
				</form>
			  </table></td>
              <td  valign="top" nowrap="nowrap" bordercolor="#33CCFF" bgcolor="#99CC99"><?php  if($parentid > 0){ 
			  include("../addActivityInfo.php");
			  }else{ echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;";}?></td>
              <td nowrap="nowrap" bordercolor="#333333" bgcolor="#CCCCCC" valign="top"><?php if($parentid > 0){ 
			  //include("../ActivitySummaryInfo.php");
			  include("../SummaryReportInfo.php");
			  }else{echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;";}?></td>
            </tr>
  <td width="56"></tr>
  <!-- BOXES BEGINS-->
  <?php if($parentid > 0){ ?>
	  <tr>
    <td colspan="3" bgcolor="#000000" height="13px" >		<span class="style11">
      <script>
		var curdt = new Date();
document.write("Today : "+(curdt.getMonth()+1)+"/"+curdt.getDate()+"/"+curdt.getFullYear()+"::"+curdt.getHours()+":"+curdt.getMinutes()+":"+curdt.getSeconds()+"");
	  </script>
    </span></td>
  </tr>
  <?php }else{ ?>
  <tr bgcolor="#CCCCCC">
    <td colspan="3"  height="200" align="center">Please enter Cash Long Master entries first and then enter details. </td>
  </tr>
  <?php }?>
</table>
</body>
</html>
<?php
mysql_free_result($RecCashLog);
mysql_free_result($Recordset1);
//mysql_free_result($rActivity);
//mysql_free_result($rLookups);

?>
<?php 
if($HTTP_SESSION_VARS["jacob_status_User"]=="jacob" || CurrentUserName()=="admin" || CurrentUserName()=="genuser" || CurrentUserName()=="master")
{
	include ("../footer.php") ;
}

?>